<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../lib/animate/animatenew.min.css">
    <style>
        .login{
            width: 250px;
            border: 1px red solid;
            padding: 10px;
        }
        input{
            margin-top: 10px;
        }
        button{
            margin-top: 10px;
            margin-bottom: 20px;
        }
        .active{
            background-color: sandybrown;
            color: seashell;
        }
    </style>
</head>
<body>
    
    <div id="app">

        <button @click="loginWay = 'login-img'" :class="{active: loginWay == 'login-img'}">扫码登录</button>
        <button @click="loginWay = 'login-pwd'" :class="{active: loginWay == 'login-pwd'}">密码登录</button>
        <transition enter-active-class="animate__animated animate__backInDown" leave-active-class="animate__animated animate__backOutDown">
            <keep-alive>
                <component :is="loginWay"></component>
            </keep-alive>
        </transition>
    </div>

    <template id="login-img">
        <div>
            <img src="../lib/image/04.jpg" alt="">
        </div>
    </template>

    <template id="login-pwd">
        <div class="login">
            用户名：<input type="text" ><br>
            密码：<input type="password">
            <button>登录</button>
        </div>
    </template>

    <script src="../lib/Vue/vue.js"></script>
    <script>

        var vm = new Vue({
            el: '#app',
            data: {
                loginWay: 'login-img'
            },
            components: {
                'login-img': {
                    template: '#login-img'
                },
                'login-pwd': {
                    template: '#login-pwd'
                }
            }
        })
    </script>
</body>
</html>